<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<title>计量院</title>
<style type="text/css">
.body {
	background-image:
		url(${pageContext.request.contextPath}/css/images/login.jpg);
}
.blue_bt_1 {
	background-image:
		url(${pageContext.request.contextPath}/css/images/button.jpg);
	background-repeat: no-repeat;
	height: 29px;
	width: 74px;
	font-size: 12px;
	color: #FFFFFF;
	text-decoration: none;
	font-family: "Microsoft YaHei";
	border-width: 0px;
	border-style: none;
	position: absolute;
	left: 753px;
	top: 441px;
	cursor: pointer;
}

.blue_bt_2 {
	background-image:
		url(${pageContext.request.contextPath}/css/images/button.jpg);
	background-repeat: no-repeat;
	height: 29px;
	width: 74px;
	font-size: 12px;
	color: #FFFFFF;
	text-decoration: none;
	font-family: "Microsoft YaHei";
	border-width: 0px;
	border-style: none;
	position: absolute;
	left: 863px;
	top: 441px;
	cursor: pointer;
}
</style>
<title>登录</title>
</head>
<body class="body">
	<form name="loginForm" id="loginForm" action='<c:url value="/misc/j_spring_security_check"/>' method="post" onsubmit="return false;">
		<span style="font-size: 26px; color: white; position: absolute; left: 508px; top: 102px;"></span> 
		<span style="font-size: 20px; color: white; position: absolute; left: 420px; top: 284px;">计量院运输管理系统</span>
	    <span style="font-size: 14px; color: white; position: absolute; left: 695px; top: 284px;">用户名</span> 
		<span style="font-size: 14px; color: white; position: absolute; left: 695px; top: 364px;">密     码</span> 
		<input style="font-size: 16px; position: absolute; left: 695px; top: 309px; height: 29px; width: 234px;" name="j_username" id="j_username"/> 
		<input style="font-size: 16px; position: absolute; left: 695px; top: 387px; height: 29px; width: 234px;" name="j_password" id="j_password" type="password"/> 
		<input type="button" value='登录' class="blue_bt_1" onclick="loginSubmit()"/> 
		<span id="sName" style="font-size: 12px; color: blue; position: absolute; left: 850px; top: 350px;display: none;" >请输入用户名</span> 
		<input type="button" value='忘记密码' class="blue_bt_2"/>
		<span id="sPwd" style="font-size: 12px; color: blue; position: absolute; left: 850px; top: 425px;">
		<c:if test="${param.error}"><label style="margin-left: 5px;"><font color="red">登录失败！</font></label></c:if>
		<c:if test="${param.timeout}"><label style="margin-left: 5px;"><font color="red">会话过期，请重新登录！</font></label></c:if>
		<c:if test="${param.logout}"><label style="margin-left: 5px;"><font color="red">你已退出！</font></label></c:if>
		</span> 
	</form>
	
	<script type="text/javascript">
	//去除IE点击按钮有虚线框
	$(function() {
		$("a, input[type='button'], input[type='submit'], input[type='checkbox']")
				.bind("focus", function() {
					if (this.blur) {
						this.blur();
					}
				});
		$("#j_username").val('');
		$("#j_password").val('');
	});
	//验证
	$(function(){
		$("#loginForm").validate({
			rules : {
				j_username : {
					required : true
				},
				j_password : {
					required : true
				}
			},
			messages : {
				j_username : {
					required:"请输入用户名"
				},
				j_password : {
					required:"请输入密码"
				}
			},
			submitHandler : function(form) {
				form.submit();
			}
		});
	});
	
	//登陆
	function loginSubmit(){
		$("#loginForm").submit();
	}
	//绑定回车
	$(function(){
        $('#j_password').bind('keypress',function(event){
            if(event.keyCode == "13")    
            {
            	loginSubmit();
            }
        });
    });
</script>
</body>
</html>